﻿
using Windows.Foundation;
namespace MetroNextTools.NData
{
    public struct NGeneratorPosition
    {
        #region Fields

        private int _index;
        private Rect _containerRect;

        #endregion

        public NGeneratorPosition(int index, Rect containerRect)
        {
            _index = index;
            _containerRect = containerRect;
        }

        public NGeneratorPosition(int index)
            : this(index, new Rect(0, 0, 0, 0))
        {

        }

        #region Properties

        public int Index
        {
            get { return _index; }
            set { _index = value; }
        }

        public Rect ContainerRect
        {
            get { return _containerRect; }
            set { _containerRect = value; }
        }

        #endregion


        public override int GetHashCode()
        {
            return this._index.GetHashCode() + this._containerRect.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            if (obj is NGeneratorPosition)
            {
                NGeneratorPosition generatorPostion = (NGeneratorPosition)obj;
                return _index == generatorPostion._index && this._containerRect == generatorPostion._containerRect ;
            }
            return false;
        }

        public static bool operator ==(NGeneratorPosition gp1, NGeneratorPosition gp2)
        {
            return gp1._index == gp2._index && gp1._containerRect == gp2._containerRect;
        }

        public static bool operator !=(NGeneratorPosition gp1, NGeneratorPosition gp2)
        {
            return !(gp1 == gp2);
        }
    }
}
